### Configuration

The `d-fi.config.json` file is where user data should be saved. The configuration file is not required for most users but sometimes there are advanced users who want to customize the way `d-fi` save files or download items.

You will have to create `d-fi.config.json` in the same directory you execute `d-fi` from. Here is the default. Double quotes are necessary. You can omit some values and `d-fi` will use defaults mentioned below.

You can also use different location for config file using argument `-conf` or `--config-file`. Example --> `d-fi -conf custom-config.json`

```js
{
  "concurrency": 4,
  "saveLayout": {
    "track": "Music/{ALB_TITLE}/{SNG_TITLE}",
    "album": "Music/{ALB_TITLE}/{SNG_TITLE}",
    "artist": "Music/{ALB_TITLE}/{SNG_TITLE}",
    "playlist": "Playlist/{TITLE}/{SNG_TITLE}"
  },
  "playlist": {
    "resolveFullPath": false
  },
  "trackNumber": true,
  "fallbackTrack": true,
  "fallbackQuality": true,
  "coverSize": {
    "128": 500,
    "320": 500,
    "flac": 1000
  },
  "cookies": {
    "arl": "xxx..."
  }
}
```

This file will also be auto-generated when you set your arl from command using `d-fi -a your_arl`. It is recommended that you set your arl cookie and keep it updated instead of relying on the default value.

### Config Details

#### _concurrency_: number <1-50>

- This sets the concurrent download when downloading albums, artists, and playlists. For example, if you set this to `8` the program will download `8` tracks at once. This boosts download speed on a faster connection but don't set this too high for reliability.

#### _saveLayout_

- `.track` save structure for single-track downloads.
- `.album` save structure for album downloads.
- `.artist` save structure for artist downloads.
- `.playlist` save structure for playlist downloads.

You can change save structure from command line as well. For example `d-fi -o "{ART_NAME} - {SNG_TITLE}"`. Available values for track, album, artist, and playlist are:

| Key               |    Description     |             Example Value             |
| :---------------- | :----------------: | :-----------------------------------: |
| `ALB_TITLE`       |    Album Title     |               Discovery               |
| `ART_NAME`        |    Artist Name     |               Daft Punk               |
| `SNG_TITLE`       |    Track Title     |   Harder, Better, Faster, Stronger    |
| `TRACK_NUMBER`    | Force track number | 04 - Harder, Better, Faster, Stronger |
| `NO_TRACK_NUMBER` | Skip track number  |                                       |

There are also additional values available only for the playlist.

| Key     |  Description   | Example Value |
| :------ | :------------: | :-----------: |
| `TITLE` | Playlist Title | wtf playlist  |

You can also find other less recently used values [here](https://github.com/d-fi/d-fi-core/tree/master/src/types)

#### _playlist_

- `.resolveFullPath` true | false

If true playlist file `.m3u8` will save files with absolute path. Example:

```
/home/sayem/Playlist/My Playlist/01 - A song.mp3
```

#### _trackNumber_: true | false

If true track number will be added to file name like this `01 - Title, 02 - Title` and so on. If false number will be omitted.

#### _fallbackTrack_: true | false

Sometimes some songs are deleted and moved. Recommended set to `true` to download if there is fallback track available. This is how deezer app works as well.

#### _fallbackQuality_: true | false

Sometimes 320kbps or flac is not available but 128kbps. By default d-fi will download 128kbps format if other formats are not available. Set this to `false` if you want to skip download.

#### _coverSize_

Album cover size in number for metadata tagging. Acceptable values are between 50-1800.

- `.128` for 128kbps,
- `.320` for 320kbps,
- `.flac` for flac,
